#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int buf[3] = {0};
//buf[0] 1开启 0关闭
//buf[1] 周期
//buf[2] 占空比

int main(int argc, const char *argv[])
{
	int fd;
	fd = open("/dev/mybeep",O_RDWR);
	if(fd == -1){
		printf("open /dev/mybeep error\n");
		return -1;
	}
	
	while(1){
		printf("input open(1)/off(0) > ");
		scanf("%d",&buf[0]);
		if(buf[0] == 1){
			printf("input zhouqi > ");
			scanf("%d",&buf[1]);	
			printf("input zhankoubi > ");
			scanf("%d",&buf[2]);
		}

		write(fd,buf,sizeof(buf));
	}
	close(fd);

	return 0;
}
